<template>
	<view class="u-p-20">
		<view class="">
			<view class="u-m-b-20 u-p-20 bg-white rounded-10" v-for="(item,index) in list" :key="index">
				<text class="">包裹状态</text>
				<view class="flex justify-between u-p-y-20" v-for="(item2,indey) in item" :key="indey">
					<u-image :src="item2.image" width="150rpx" height="150rpx"></u-image>
					<view class="flex-1 flex flex-column justify-between u-p-l-20" style="width: 100%;">
						<view class="flex align-center" style="width: 100%;">
							<text class="flex flex-nowrap" style="white-space: nowrap;">商品名称：</text>
							<text class="text-ellipsis" style="width: 300rpx;">{{ item2.goods_name }}</text>
						</view>
						<view class="flex align-center justify-between u-p-y-10">
							<text>收货人： {{ address.name }}</text>
							<view class="">
								<u-button size="mini" shape="circle" type="error" 
								          @click="toDetail(item2.express_no, item2.express_company,item2.order_id)">查看物流</u-button>
							</view>
						</view>
						<view class="flex align-center">
							<text class="flex flex-nowrap" style="white-space: nowrap;">收货地址：</text>
							<text class="u-line-1" style="width: 300rpx;">{{address.province+address.city+address.area+address.detail}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { OrderCenterApi } from '@/api/serves.js'
	export default {
		data() {
			return {
				order_no: '',
				list: [],
				address: ''
			}
		},
		onLoad(options) {
			console.log(options);
			this.order_no = options.order_no
			this._initData()
		},
		methods: {
			_initData() {
				this.$ShowLoading()
				OrderCenterApi.orderDetail({ order_no: this.order_no }).then(res => {
					this.$HideLoading()
				  console.log('订单详情', res);
					if(res.code == 1){
						this.list = res.data.order.express;
						this.address = res.data.order.address;
					}else {
					this.$Toast(res.msg)
					}
				})
			},
			toDetail(express_no, express_company, order_id) {
				let params = {
					express_no,
					express_company,
					order_id,
				}
				uni.navigateTo({
					url: '/pages/order/mineOrderParcelDetail/mineOrderParcelDetail?info=' + JSON.stringify(params)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
